
function search() {
document.indexForm.submit();
}


function isEmail(str){
	   var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
　　flag = pattern.test(str);  
       if(!flag) {
			alert("邮箱地址不合法!");
	   }
}


//================================================
function submitForm(){		 
		
		  var email = document.getElementById("email").value;
		  var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
		   if(!reg.test(email)) {
				alert("邮箱地址不合法!");
				return false;
		   }
		   
	  	document.addForm.submit(); 
		}

function submitAddrs() {

	if(document.getElementById("consignee").value == "" ) {
		alert("请输入收件人姓名");
		return false;
	}
	
	
	if(navigator.userAgent.indexOf("MSIE")>0) {
	
		if(document.getElementById("areaoutput").outerText == "" ) {
			alert("请选择地区！");
			return false;
		}else{
			if(document.getElementById("province").value == "" ) {
			alert("请选择地区！");
			return false;
		}

　	　}
}

	if(navigator.userAgent.indexOf("Firefox")>0){
		if(document.getElementById("areaoutput").textContent == "" ) {
			alert("请选择地区！");
			return false;
		} else{
			if(document.getElementById("province").value == "" ) {
			alert("请选择地区！");
			return false;
		}

		}
　}


	if(document.getElementById("address").value == "" ) {
		alert("请输入街道地址！");
		return false;
	}
	if(document.getElementById("post_code").value == "" ) {
		alert("请输入邮编");
		return false;
	}
	if(document.getElementById("cellphone").value == ""  || document.getElementById("tel").value == "" ) {
		alert("请输入手机号码或固定电话");
		return false;
	}	

	  //地区拼串
		var area_attr_str = "";
		if(document.getElementById("province").value!=""){
			area_attr_str += document.getElementById("province").value+"|";
			if(document.getElementById("eparchy_code").value!=""){
				area_attr_str += document.getElementById("eparchy_code").value+"|";
				if(document.getElementById("city_code").value!=""){
					area_attr_str += document.getElementById("city_code").value+"|";
				}
			}
		}

		if(area_attr_str == ""){
		document.getElementById("area_attr").value = document.getElementById("area_attr_bak").value 
		}else{
		document.getElementById("area_attr").value = area_attr_str;
		}
document.addForm.submit(); 
}


 function copy(){
      var ss = document.getElementById("share-copy-text").value;
      copyToClipboard(ss);
 }
 
 function copyToClipboard(txt) {
      if(window.clipboardData) {
              window.clipboardData.clearData();
              window.clipboardData.setData("Text", txt);
              alert("复制成功！");
      } else if(navigator.userAgent.indexOf("Opera") != -1) {
           window.location = txt;
      } else if (window.netscape) {
           try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
           } catch (e) {
                alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
           }
           var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
           if (!clip)
                return;
           var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
           if (!trans)
                return;
           trans.addDataFlavor('text/unicode');
           var str = new Object();
           var len = new Object();
           var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
           var copytext = txt;
           str.data = copytext;
           trans.setTransferData("text/unicode",str,copytext.length*2);
           var clipid = Components.interfaces.nsIClipboard;
           if (!clip)
                return false;
           clip.setData(trans,null,clipid.kGlobalClipboard);
           alert("复制成功");
      }
	}

